"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
  class Problems extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      Problems.belongsTo(models.Staff, {
        foreignKey: "staff_id",
        allowNull: true,
      });
      // Problems.belongsTo(models.Contract,{
      //   foreignKey:'contract_id',
      // })
    } // define association here
  }
  Problems.init(
    {
      number: DataTypes.STRING,
      type: DataTypes.STRING,
      content: DataTypes.TEXT,
      reply: DataTypes.TEXT,
    },
    {
      sequelize,
      modelName: "Problems",
      tableName: "problems",
    }
  );
  return Problems;
};
